﻿'========================================================================
'功能:申請MVPN
'作者:shihyu
'日期:2011/05/17
'========================================================================
Imports System.Data
Partial Class WebForm_SysParam_Apply
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            hiUID.Value = ActualUID
            hidbName.Value = dbName
            txtMonth.Text = Now.AddMonths(-1).ToString("yyyy/MM")
            If Not ChkProgramRight(1) Then '查詢
                btnQuery.Visible = False
                gvQueryCharge.Visible = False
            End If
        End If
    End Sub

   
    Protected Sub btnQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnQuery.Click


        Dim Month As String = Me.txtMonth.Text
        Dim Phone As String = Me.txtPhone.Text

        '檢查月份
        If Month.Length <> 7 OrElse Month.Substring(4, 1) <> "/" OrElse IsNumeric(Left(Month, 4)) = False OrElse IsNumeric(Right(Month, 2)) = False Then
            BasePage.ShowMessageForAjax(btnQuery, GetLocalResourceObject("MonthFormatErr"))
            Exit Sub
        ElseIf Month = "" Then
            BasePage.ShowMessageForAjax(btnQuery, GetLocalResourceObject("MonthErrEmpty"))
            Exit Sub
        End If

        '檢查門號
        If Phone = "" Then
            BasePage.ShowMessageForAjax(btnQuery, GetLocalResourceObject("PhoneErrEmpty"))
            Exit Sub
        ElseIf IsNumeric(Phone) = False Then
            BasePage.ShowMessageForAjax(btnQuery, GetLocalResourceObject("PhoneTypeErr"))
            Exit Sub
        End If


        Me.gvQueryCharge.Visible = True
        Me.gvQueryCharge.DataBind()

    End Sub



    Protected Sub gvQueryCharge_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvQueryCharge.DataBound
        For ii = 0 To gvQueryCharge.Rows.Count - 1
            If ii = 0 Then
                ' gvQueryCharge.Rows(ii).Cells(5).Visible = True
            Else
                gvQueryCharge.Rows(ii).Cells(5).Text = ""
            End If
        Next
    End Sub
End Class
